package cn.gson.crm.control.total;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.TotalDao;
import cn.gson.crm.model.entity.TotalService;

/**
 * Servlet implementation class AllPayedServlet
 */
@WebServlet("/allpayed")
public class AllPayedServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
    private TotalDao td=new TotalDao();   
    
    @Override
    protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
    	String p = request.getParameter("page");
		String studentName = request.getParameter("studentName");
		if (p == null || p.isEmpty()) {
			p = "1";
		}
		Integer page = Integer.parseInt(p);
		// 当前页数据
		List<TotalService> totalList = td.getAllPageTotalServiceListByType(page, studentName);
		// 总页数
		int totalPage = td.getAllTotalServicePage(studentName);
		System.out.println("*****"+studentName);
		request.setAttribute("queryString", noPageQueryString());
		request.setAttribute("totalList", totalList);
		request.setAttribute("totalPage", totalPage);
		request.setAttribute("page", page);
		forward("total/allpayed.jsp");
    }
}
